﻿package mortal.game.view.ranking.renderer
{
    import Message.Public.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import extend.language.*;
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class RankingCategoryRenderer extends GCellRenderer
    {
        private var _txtName:GTextFiled;
        private var _txtStatus:GTextFiled;
        private var _line:ScaleBitmap;

        public function RankingCategoryRenderer()
        {
            return;
        }// end function

        override protected function initSkin() : void
        {
            var _loc_1:* = new Bitmap();
            this.setStyle("downSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            this.setStyle("overSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            this.setStyle("upSkin", _loc_1);
            this.setStyle("selectedDownSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            this.setStyle("selectedOverSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            this.setStyle("selectedUpSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._txtName.text = param1.label;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            var _loc_1:* = GlobalStyle.textFormatPutong;
            _loc_1.align = TextFormatAlign.CENTER;
            this._txtName = UIFactory.gTextField("", 12, 1, 155, 20, this, _loc_1);
            _loc_1.align = TextFormatAlign.RIGHT;
            this._txtStatus = UIFactory.gTextField("", 12, 1, 160, 20, this, _loc_1);
            this._line = UIFactory.bg(0, 20, 180, 1, this, ImagesConst.SplitLine);
            this.configEventListener(MouseEvent.CLICK, this.clickMeHandler);
            return;
        }// end function

        private function clickMeHandler(event:MouseEvent) : void
        {
            var _loc_4:int = 0;
            var _loc_2:* = Cache.instance.role.entityInfo.level;
            var _loc_3:* = data["type"] as int;
            if (_loc_3 == EToplistType._EToplistTypeFashion)
            {
                _loc_4 = GameConst.ClothOpenLevel;
            }
            if (_loc_3 == EToplistType._EToplistTypeWing)
            {
                _loc_4 = GameConst.WingOpenLevel;
            }
            if (_loc_3 == EToplistType._EToplistTypeWeapon)
            {
                _loc_4 = GameConst.ArtifactOpenLevel;
            }
            if (_loc_2 < _loc_4)
            {
                MsgManager.showRollTipsMsg(Language.getString(41321));
                return;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.RankingGetRankList, data));
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._txtName.dispose(param1);
            this._txtName = null;
            this._line.dispose(param1);
            this._line = null;
            this._txtStatus.dispose(param1);
            this._txtStatus = null;
            return;
        }// end function

        override public function set label(param1:String) : void
        {
            return;
        }// end function

    }
}
